<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '门诊表格搜索';
$this->registerJsFile('@web/js/search.js?v=2', ['depends' => 'app\assets\AppAsset']);
?>
<style type="text/css">
    .search-div > div > table {width: 1000px !important;}
    .med-search {width: auto; display: inline;}
</style>


<p>
    <?php // Html::a('详情搜索', '#', ['class' => 'btn btn-success', 'id' => 'chooseButton']) ?>
    <?= Html::a('清空搜索', ['/search/excel'], ['class' => 'btn btn-primary']) ?>
</p>

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        [
            'class' => 'yii\grid\ActionColumn',
            'buttons' =>[
                'view' => function($url, $model, $key) {
                    return Html::a('<i class="fa fa-paper-plane"></i>', '/search/search/enter/?id='.$model->pt_id.'&type=excel');
                },
            ],
            'template' => '{view}',
        ],

        [
        	'attribute' => 'ppt_id',
        	'value' => function($data) {
                return isset($data->patient->pt_id) ? $data->patient->pt_id : '';
        	}
        ],
        [
        	'attribute' => 'pt_name',
        	'value' => function($data) {
                return isset($data->patient->pt_name) ? $data->patient->pt_name : '';
        	}
        ],
        [
            'attribute' => 'pt_diagnose',
            'value' => function($data) {
                switch ($data->pt_diagnose) {
                    case 'pdf': $string = 'PD复诊'; break;
                    case 'pd' : $string = 'PD初诊'; break;
                    case 'pdx' : $string = '帕金森病患者营养状况横断面研究病例报告表'; break;
                    case 'udprs' : $string = '美多芭冲击试验'; break;
                    case 'udprs2' : $string = 'UDPRS'; break;
                    
                    default: $string = strtoupper($data->pt_diagnose); break;
                }
                return $string;
            },
            'filter' => ['pd' => 'PD初诊', 'pdf' => 'PD复诊', 'udprs' => '美多芭冲击试验', 'udprs2' => 'UDPRS', 'et' => 'ET', 'sca' => 'SCA', 'cmt' => 'CMT', 'hsp' => 'HSP', 'pfbc' => 'PFBC', 'fcmte' => 'FCMTE', 'pdx' => '帕金森病患者营养状况横断面研究病例报告表'],
        ],
        'crt_name',
        'crt_time',
    ],
]); ?>
